package com.hb.trans.mvp.ui.fragment


import com.basiclib.base.BaseFragment
import com.ctcnit.templatepro.global.MyGlideModule
import com.hb.trans.R
import com.hb.trans.global.DataStore
import com.hb.trans.mvp.contract.BaseInfoContract
import com.hb.trans.mvp.presenter.BaseInfoPresenter
import dagger.android.support.AndroidSupportInjection
import kotlinx.android.synthetic.main.fragment_base_info.*
import javax.inject.Inject

class BaseInfoFragment : BaseFragment<BaseInfoPresenter>(), BaseInfoContract.View {
    override fun setViewId(): Int {
        return R.layout.fragment_base_info
    }

    override fun doOnInvisible() {
        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
    }

    override fun doOnVisible() {
        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
    }

    @Inject
    lateinit var mPresenter: BaseInfoPresenter

//    lateinit var rootView: View

    companion object {
        fun newInstance(): BaseInfoFragment {
            val fragment = BaseInfoFragment()
            return fragment
        }
    }

//    override fun initView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
//        rootView = inflater.inflate(R.layout.fragment_base_info, container, false)
//        return rootView
//    }

    override fun onFragmentInject() {
        AndroidSupportInjection.inject(this)
    }

    override fun attachView() {
    }

    override fun initView() {
        DataStore.getInstance().getStudentInfo()?.let {
            MyGlideModule.loadRoundRadiusWithSex(
                mContext,
                it.photourl,
                ivAvater,
                4,
                R.mipmap.ic_default_avater,
                R.mipmap.ic_default_avater
            )
            tvName.text = it.name
            tvCarType.text = "驾照类型:${it.traintype}"
            tvCardNum.text = it.idcard
            tvSchoolName.text = it.schName
            tvTime.text = it.applydate
            tvPhone.text = it.phone
            tvServer.text = it.platName
        }
    }

    override fun initData() {
    }
}
